<?php

$foo=$_GET["updateid"];

include("mysql_conn.php");
include("settings.php");

$result=mysql_query("select updateid,projectid,updatetext,date(updatetime),date_format(updatedate,'%m/%d/%Y') as updatedate,updatetype from updates where updateid='$foo'");

while($row=mysql_fetch_array($result))
{
 $updatetime=$row['date(updatetime)'];
 $updatetext=$row['updatetext'];
 $projectid=$row['projectid'];
 $updatedate=$row['updatedate'];
 $updatetype=$row['updatetype'];
}

if ($updatetype == 'T')
{ 
 $taskcheck='checked';
 $obscheck='unchecked';
 $nextcheck='unchecked';
}
if ($updatetype == 'O')
{       
 $taskcheck='unchecked';
 $obscheck='checked';
 $nextcheck='unchecked';
}
if ($updatetype == 'N')
{       
 $taskcheck='unchecked';
 $obscheck='unchecked';
 $nextcheck='checked';
}

echo "<html><head><title>$site_title: Edit Update</title>
<link rel='stylesheet' type='text/css' href='style.css'>
</head><body>
<h3>Edit Update</h3>
<form action='editupdate-do.php' method='post'>
<table width=80%>
<tr><th width=9%>Date</th>
<th>Update</th></tr>
<tr><td><input type='hidden' name='updateid' value='$foo'>
<input type='hidden' name='projectid' value='$projectid'><input type='text' name='updatedate' size='10' value='$updatedate'></td>
<td><textarea name='updatetext' cols='120' rows='4'>$updatetext</textarea></td></tr>
<tr><th>Type</th><td><input type='radio' name='updatetype' value='T' $taskcheck>Task Completed <input type='radio' name='updatetype' value='O' $obscheck>Obstacle <input type='radio' name='updatetype' value='N' $nextcheck>Next Step</td></td>

</table>
<input type='submit' value='Apply'>";

mysql_close($con)
?>
